﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>WordPaster-ScreenCapture整合示例</title>
    <script type="text/javascript" src="ueditor.config.js" charset="utf-8"></script>
    <script type="text/javascript" src="ueditor.all.js" charset="utf-8"></script>
    <!--<script type="text/javascript" src="ueditor.all.min.js" charset="utf-8"></script>-->
    <link type="text/css" rel="Stylesheet" href="demo.css" />
    <link type="text/css" rel="Stylesheet" href="scp/scp.css" />
    <link type="text/css" rel="Stylesheet" href="WordPaster/js/skygqbox.css" />
    <script type="text/javascript" src="WordPaster/js/json2.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/jquery-1.4.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/skygqbox.js" charset="utf-8"></script>
    <script type="text/javascript" src="WordPaster/js/w.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/scp.app.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/scp.edge.js" charset="utf-8"></script>
    <script type="text/javascript" src="scp/scp.js" charset="utf-8"></script>
    <script type="text/javascript" src="demo.js" charset="utf-8"></script>
</head>
<body>
    <div id="demos"></div>    
	<textarea name="后台取值的key" id="myEditor">这里写你的初始化内容</textarea>
    <div id="scpPanel"></div>
	<script type="text/javascript">
        var pos = window.location.href.lastIndexOf("/");
        var api = [
            window.location.href.substr(0, pos + 1),
            "upload.aspx"
        ].join("");
        WordPaster.getInstance({
            //上传接口：http://www.ncmem.com/doc/view.aspx?id=d88b60a2b0204af1ba62fa66288203ed
            PostUrl: api,
            //为图片地址增加域名：http://www.ncmem.com/doc/view.aspx?id=704cd302ebd346b486adf39cf4553936
            ImageUrl: "",
            //设置文件字段名称：http://www.ncmem.com/doc/view.aspx?id=c3ad06c2ae31454cb418ceb2b8da7c45
            FileFieldName: "file",
            //提取图片地址：http://www.ncmem.com/doc/view.aspx?id=07e3f323d22d4571ad213441ab8530d1
            ImageMatch: ''            
        });//加载控件

        var editor = null;
    	var scpMgr = new CaptureManager();
    	scpMgr.Config["PostUrl"] = "http://localhost:1761/upload.aspx";
        scpMgr.event.postComplete = function (url) {
            var img = '<img src="' + url + "?t=" + new Date().getTime() + '"/>';
            editor.execCommand("insertHtml", img);
        };
        scpMgr.event.hotKey = function () {
            setTimeout(function () {
                scpMgr.Capture2();
            }, 100);
        };
        scpMgr.loadAuto();
		
		 UE.getEditor('myEditor',{onready:function(){//创建一个编辑器实例
             WordPaster.getInstance().SetEditor(this);
             editor = this;
		 }});
	</script>
</body>
</html>
